import { administrator, ADMINISTRATOR } from '../../src/lib/Member'
import { ClsMember } from "../model";
import { ILike } from "typeorm";


export async function adminUpdate() {
  const [dbUser] = await ClsMember.findAndCountBy({
    userType: ILike('%admin%')
  });

  if (Array.isArray(dbUser)) {
    for (const member of dbUser) {
      const adminClass = administrator.get(ADMINISTRATOR) ?? new Set();

      administrator.set(ADMINISTRATOR, adminClass.add(member.userId))
      console.log('------------------- adminUpdate -----------------------')
      console.log(administrator)
    }
  }
}
